package club.kingyin.kyblog.core.utils.serialization;

/**
 * @author : kingyins
 * @version : 1.0
 * @program : Ky-Blog
 * @description : 在此处添加类描述
 * @create : 2021年08月16日 10:44
 **/

public class ByteUtil {

    public static String encoder(byte[] bytes){
        StringBuilder res = new StringBuilder();
        for (byte b : bytes) {
            res.append(ByteString.mapping(b));
        }
        return res.toString();
    }

    public static byte[] decoder(String resource) {
        byte[] res = new byte[resource.length()];
        for (int i = 0; i < resource.length(); i++) {
            res[i] = ByteString.mapping(resource.charAt(i));
        }
        return res;
    }

}
